package com.lvy.hczn.front.business.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lvy.hczn.front.system.domain.business.SpuGradeStandard;
import com.lvy.hczn.front.business.mapper.SpuGradeStandardMapper;
import com.lvy.hczn.front.business.service.SpuGradeStandardService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class SpuGradeStandardServiceImpl extends ServiceImpl<SpuGradeStandardMapper, SpuGradeStandard> implements SpuGradeStandardService {

    @Autowired
    private SpuGradeStandardMapper spuGradeStandardMapper;

    /**
     * 查询等级列表||spId||categoryId条件查询
     *
     * @param spuGradeStandard
     * @return java.util.List<com.lvy.hczn.model.order.SpuGradeStandard>
     * @author yw
     * @date 2022-07-27 17:14:07
     */
    @Override
    public List<SpuGradeStandard> selectList(SpuGradeStandard spuGradeStandard) {
        LambdaQueryWrapper<SpuGradeStandard> wrapper = new LambdaQueryWrapper();
        if (!StrUtil.isEmpty(spuGradeStandard.getSpuId())) {
            wrapper.eq(SpuGradeStandard::getSpuId, spuGradeStandard.getSpuId());
        }
        if (!StrUtil.isEmpty(spuGradeStandard.getCategoryId())) {
            wrapper.eq(SpuGradeStandard::getCategoryId, spuGradeStandard.getCategoryId());
        }
        return super.list(wrapper);
    }
}
